<template>
    <h1>学生个数{{ count }}</h1>
    <button @click="getStudents">查询</button>
</template>

<script lang="ts" setup>
// import axios from "axios";
import axios from "../api/request.ts";
import {ref,onMounted} from "vue";

let count = ref(0);

async function getStudents() {
    // const promise = await axios.get(`${import.meta.env.VITE_BACKEND_API_BASE_URL}/api/students`);
    const promise = await axios.get(`/api/students`);
    // console.log(promise)
    const data = promise.data?.data.length;
    console.log(data);
    count.value = data
}
onMounted(()=>{
    getStudents()
})
getStudents()

</script>


